<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport"
    content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
  <title>打印收据</title>
  <link rel="stylesheet" href="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/element-plus/2.0.4/index.min.css" />
  <link rel="stylesheet" href="https://ks3-cn-beijing.ksyun.com/vform3/render.style.css?t=20220129">
  <style type="text/css">
  </style>
</head>

<body>

  <div id="app" style="width: 617px;">
    <v-form-render :form-json="formJson" :form-data="formData" :option-data="optionData" ref="vFormRef">
    </v-form-render>
  </div>

  <script src="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/3.2.30/vue.global.min.js"></script>
  <script src="https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/element-plus/2.0.4/index.full.min.js"></script>
  <script src="https://ks3-cn-beijing.ksyun.com/vform3/render.umd.js?t=20220129"></script>
  <script type="text/javascript" src="__STATIC__/js/vform.js"></script>
  <!-- axios -->
  <script src="__STATIC__/js/axios.min.js"></script>
  <script type="text/javascript"
    src="__STATIC__/js/main.js?{if $Think.env.app_debug}_={:time()}{else /}v={$Think.config.tpadmin.version}{/if}"></script>
  <script>
    let that = this
    axiosGet("{:url('house.uncollected/queryData')}", { id: '{$id}' }).then(response => {
      if (response.code == 1) {
        let formJsonData = response.data.end_time ? formJson : formJson1;
        const { createApp } = Vue;
        const app = createApp({
          data() {
            return {
              formJson: formJsonData,
              formData: response.data,
              optionData: {}
            }
          },
        });
        app.use(ElementPlus)
        app.use(VFormRender)
        app.mount("#app");
        window.print()
      } else {
        that.$message.error('系统出错了!!!');
      }
    });

    var afterPrint = function () {
      window.close()
    };
    if (window.matchMedia) {   //返回一个新的 MediaQueryList 对象，表示指定的媒体查询字符串解析后的结果。
      var mediaQueryList = window.matchMedia('print');
      mediaQueryList.addListener(function (mql) {
        if (!mql.matches) {
          afterPrint();
        }
      });
    }
    window.onafterprint = afterPrint;
  </script>
</body>

</html>